Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rdlc.rdl
Class Instance

    java.lang.Object
      rdlc.naming.Catalog<java.lang.String,V>
          rdlc.naming.HierarchicalCatalog<Field>
              rdlc.rdl.Instance

All Implemented Interfaces:
  Expression, Field

Direct Known Subclasses:
  Instance_Base, MapInstance, ModuleInstance_Standard, ModuleParameterGroup, ModuleWireGroup, PlatformInstance, Type_Root, UnitInstance

    public abstract class Instance

extends HierarchicalCatalog<Field>
implements Field

This class represents a node in an instance hierarchy. This gets used extensively for example when RDL units are constructed hierarchically, but the same goes for maps and platforms. Because RDL includes features like connections made at higher levels of the instance hierarchy, it is necessary to maintin copies of these instance trees for each root. IE, a leaf unit will contain it's own instance, but when that unit is instantiated, a COPY of it's instance node will be placed in the containing unit's instance hierarchy. Aside from this rather complex feature, instances are a direct parally to namespaces except that they use dynamic identifiers, rather than static, and do not include the ability to declare a field outside of it's own instance.

Version:
  $Revision: 1.31 $
Author:
  Greg Gibeling

Nested Class Summary
`protected static class` | `Instance.Accessor` Accessor class for instances.
`static class` | `Instance.Identifier` Identifier for instsances and fields.
`protected static class` | `Instance.LateBindField` LateBindField holds a field and it dynamic identifier for later binding into a instance.
`static class` | `Instance.QualifiedIdentifier` Qualified identifier for fields.

Nested classes/interfaces inherited from class rdlc.naming.HierarchicalCatalog
`HierarchicalCatalog.DefaultAccessor<_V>`

Nested classes/interfaces inherited from interface rdlc.rdl.Expression
`Expression.Phase`

Field Summary
`protected Expression.Phase` | `bound` A flag to prevent us from trying to bind all of the identifiers twice.
`protected Expression.Phase` | `copied` A flag to prevent us from trying to copy the sub instances twice.
`protected Instance` | `copySource` The instance from which this one was copied.
`protected DynRoot` | `dynRoot` The dynamic root, the `DynRoot` which this instance represents.
`protected java.util.List<Instance.LateBindField>` | `lateBindFieldList` A list of fields to late bind.
`protected Namespace` | `namespace` The namespace in which this instance was declared.
`protected Expression.Phase` | `resolved` A flag to prevent us from trying to resolve the dynamics in this instance twice.

Fields inherited from class rdlc.naming.HierarchicalCatalog
`cachedIdentifier, cachedRoot, name, parent`

Fields inherited from class rdlc.naming.Catalog
`entryList, indexTable`

Constructor Summary
`Instance(java.lang.String _name, DynRoot _dynRoot)` Root constructor for an instance which marks the root of a dynamic hierarchy.
`Instance(java.lang.String _name, Instance _instance, boolean copy)` Hierarchical or copy constructor, creates an instance in a dynamic tree.

Method Summary
`void` | `add(Field_Named _fieldNamed)` Add the given named field to this instance.
`void` | `add(Instance _fieldInst)` Add the given instance as a child of this instance.
`protected void` | `bindFields(java.util.HashSet<Declaration> markSet, Log errorLog, Expression.Phase phase)` Bind all of the non-instance fields which have been added with `add(Field_Named)`.
`void` | `copySubInstance(java.util.HashSet<Declaration> markSet, Log errorLog, Expression.Phase phase)` Make of copy of all the fields in the root instance reported by our `DynRoot` object.
`Instance.Identifier` | `createIdentifier(java.util.List<java.lang.String> lName, Log errorLog)` Create a dynamic identifier which names a field from a list of strings.
`DynRoot` | `getDynRoot()` Simple accessor.
`void` | `getRequirements(CatalogSet<Identifier<Declaration>> requirements)` An instance only depends on the dependancies of it's fields (and of course it's fields).
`void` | `resolve(java.util.HashSet<Declaration> markSet, Log errorLog, Expression.Phase phase)` In addition to invoking `Instance#copySubInstance(HashSet, Log, Phase)` this method simple calls `Expression.resolve(HashSet, Log, Phase)` on all of this instances fields.
`void` | `setInstance(Instance _instance)` Simple accessor.
`void` | `setNamespace(Namespace _namespace)` Simple accessor.
`void` | `setRawDynamicID(RawDynamicIdentifier _rawDynamicID)` Simple accessor.
`java.lang.String` | `toString()` Simple accessor.
`boolean` | `typeMatch(Expression e)` Two instances will never type match.

Methods inherited from class rdlc.naming.HierarchicalCatalog
`connectParent, getIdentifier, getName, getParent, getRoot, hashCode`

Methods inherited from class rdlc.naming.Catalog
`clear, containsKey, entryList, get, get, getKey, isEmpty, keySet, put, put, putAll, remove, size`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface rdlc.rdl.Field
`copy, getIdentifier`

Field Detail

### namespace

    protected Namespace namespace

  The namespace in which this instance was declared.

### resolved

    protected Expression.Phase resolved

  A flag to prevent us from trying to resolve the dynamics in this instance twice. Basically to save us a lot of potentially wasted cycles.

### lateBindFieldList

    protected java.util.List<Instance.LateBindField> lateBindFieldList

  A list of fields to late bind.

### bound

    protected Expression.Phase bound

  A flag to prevent us from trying to bind all of the identifiers twice.

### copied

    protected Expression.Phase copied

  A flag to prevent us from trying to copy the sub instances twice.

### dynRoot

    protected DynRoot dynRoot

  The dynamic root, the `DynRoot` which this instance represents.

### copySource

    protected Instance copySource

  The instance from which this one was copied.

Constructor Detail

### Instance

    public Instance(java.lang.String _name,
                    DynRoot _dynRoot)

  Root constructor for an instance which marks the root of a dynamic hierarchy.

  Parameters:
    `_name` - The name for this instance.
    `_dynRoot` - The dynamic root to which this instance corresponds.

### Instance

    public Instance(java.lang.String _name,
                    Instance _instance,
                    boolean copy)

  Hierarchical or copy constructor, creates an instance in a dynamic tree. For hierarchical construction this instance will not have a dynamic tree root associated with it and this feature is only used during output generation. For copy construction this method will record the copy source and get it's dynamic root.

  Parameters:
    `_name` - The name for this instance.
    `_instance` - The instance to copy from or use as a parent.
    `copy` - Should this constructor copy the given instance?

Method Detail

### toString

    public java.lang.String toString()

  Simple accessor.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A human readable string representation of this instance for debugging.

### add

    public void add(Field_Named _fieldNamed)

  Add the given named field to this instance. For an instance which has not been resolved this will add it to the late binding list for binding during `resolve()`. Whereas for an instance which has already been resolved this will add the field directly in. In both cases it will call `setInstance` as appropriate.

  Parameters:
    `_fieldNamed` - The named field being added to this instance.
  See Also:
    `Expression.resolve(HashSet, Log, Phase)`, `Field.setInstance(Instance)`

### add

    public void add(Instance _fieldInst)

  Add the given instance as a child of this instance. Note that this is much simpler than `add(Field_Named)`.

  Parameters:
    `_fieldInst` - The instance to add to this one.

### setRawDynamicID

    public void setRawDynamicID(RawDynamicIdentifier _rawDynamicID)

  Simple accessor. Used during normal parsing. Note that this method will also update the `HierarchicalCatalog.cachedIdentifier` field as appropriate.

  Specified by:
    `setRawDynamicID` in interface `Field`
  Parameters:
    `_rawDynamicID` - Set the raw dynamic identifier with which this field is declared.

### setInstance

    public void setInstance(Instance _instance)

  Simple accessor. Used during normal parsing. Note that this also takes care of regenerating the identifier as required, and updating the instance in which all of this instance's fields exist. This is necessary to update the appropriate identifiers.

  Specified by:
    `setInstance` in interface `Field`
  Parameters:
    `_instance` - The instance in which this instance was declared.
  See Also:
    `Instance#copySubInstance(HashSet, Log, Phase)`

### getDynRoot

    public DynRoot getDynRoot()

  Simple accessor.

  Returns:
    The dynamic root object to which this instance corresponds.

### bindFields

    protected void bindFields(java.util.HashSet<Declaration> markSet,
                              Log errorLog,
                              Expression.Phase phase)

  Bind all of the non-instance fields which have been added with `add(Field_Named)`. All this method does is iterate over `lateBindFieldList` and `bind()` them.

  Parameters:
    `markSet` - Complete hash set of expressions on which the caller depends (including itself).
    `errorLog` - A list of all the errors to be reported.
    `phase` - The phase of resolution to perform.
  See Also:
    `Instance.LateBindField#bind(Log, Phase)`

### copySubInstance

    public void copySubInstance(java.util.HashSet<Declaration> markSet,
                                Log errorLog,
                                Expression.Phase phase)

  Make of copy of all the fields in the root instance reported by our `DynRoot` object. This is required to ensure that there are separate instance hierarchies, one rooted at each `DynRoot`. We take advantage of this fact for example when dealing with non-local channel connections.

  Parameters:
    `markSet` - Complete hash set of declarations on which the caller depends (including itself).
    `errorLog` - A list of all the errors to be reported.
    `phase` - The phase of resolution to perform.
  See Also:
    `Expression.resolve(HashSet, Log, Phase)`

### setNamespace

    public void setNamespace(Namespace _namespace)

  Simple accessor. Used during normal parsing. Note that this also takes care of updating the namespace in which all of this instance's fields exist.

  Specified by:
    `setNamespace` in interface `Expression`
  Parameters:
    `_namespace` - The namespace in which this instance was declared.

### resolve

    public void resolve(java.util.HashSet<Declaration> markSet,
                        Log errorLog,
                        Expression.Phase phase)

  In addition to invoking `Instance#copySubInstance(HashSet, Log, Phase)` this method simple calls `Expression.resolve(HashSet, Log, Phase)` on all of this instances fields.

  Specified by:
    `resolve` in interface `Expression`
  Parameters:
    `markSet` - Complete hash set of declarations on which the caller depends (including itself).
    `errorLog` - Log of errors to be reported to the user.
    `phase` - The phase of resolution to perform.

### typeMatch

    public boolean typeMatch(Expression e)

  Two instances will never type match.

  Specified by:
    `typeMatch` in interface `Expression`
  Parameters:
    `e` - The expression to check this one against.
  Returns:
    `false`

### getRequirements

    public void getRequirements(CatalogSet<Identifier<Declaration>> requirements)

  An instance only depends on the dependancies of it's fields (and of course it's fields).

  Specified by:
    `getRequirements` in interface `Expression`
  Parameters:
    `requirements` - A list to which this will add the declarations upon which this one relies.

### createIdentifier

    public Instance.Identifier createIdentifier(java.util.List<java.lang.String> lName,
                                                Log errorLog)

  Create a dynamic identifier which names a field from a list of strings. This can be used to turn a command line typed string into a full dynamic identifier which can then be dereferenced to get a field.

  Parameters:
    `lName` - A list of strings to turned into a fully qualified dynamic identifier.
    `errorLog` - A log to add all the errors to.
  Returns:
    A dynamic identifier.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD